<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title>弓友之家</title>
    <link rel="stylesheet" href="css/mui.css" />
    <link rel="stylesheet" href="fonts/iconfont.css" />
    <link rel="stylesheet" href="css/style.css" />
    <style>
    	.user-integral ul li:after{left: 0;}
    </style>
</head>
<body>
	<header class="mui-bar mui-bar-nav">
		<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		<h1 class="mui-title">我的积分</h1>
	</header>
	<div class="mui-content">
		<div class="rank-title mui-clearfix">
			<a data-type="2" class="on">全部记录</a>
			<a data-type="1">获得积分</a>
			<a data-type="0">消费积分</a>
		</div>
	    <div class="user-integral">
	        <ul class="mui-table-view">
	        	
	        </ul> 
	    </div>
	</div>
	<br />
	<script type="text/javascript" src="js/mui.min.js" ></script>
	<script type="text/javascript" src="js/jquery-1.8.3.min.js" ></script>
	<script type="text/javascript" src="js/common.js" ></script>
	<script type="text/javascript" charset="utf-8">
      	mui.init();
      	var type=2;
      	integral();
      	$(".rank-title").on("tap","a",function(){
      		$(this).addClass("on").siblings().removeClass("on");
      		type=$(this).attr("data-type");
      		integral();
      	})
      	
      	function integral(){
      		mui.ajax(H_SRC+'/amier/user/integral',{
				data:{
					token:token,
					type:type
				},
				dataType:'json',
				type:'post',
				timeout:10000,             
				success:function(data){
					var dataurl=data.data;
					if(data.code == 1){
	      				var jf="";
	      				for(var i=0;i<dataurl.length;i++){
	      					if(dataurl[i].isPlus==0){
	      						jf+='<li class="mui-table-view-cell">';
	      						var isplus="-"
	      					}else{  
	      						jf+='<li class="mui-table-view-cell on">';
	      						var isplus="+"
	      					}
	      					if(dataurl[i].scene==1){
	      						var scene="用户登录"
	      					}else if(dataurl[i].scene==2){
	      						var scene="商品购买"
	      					}else{
	      						var scene="后台添加"
	      					}
	      					jf+='<a class="mui-row"><div class="mui-col-xs-9">';
		        			jf+='<h4 class="mui-ellipsis">'+scene+'</h4><p>'+dataurl[i].c_time+'</p>';
			        		jf+='</div><div class="mui-col-xs-3 mui-text-right">'+isplus+''+dataurl[i].integral;
			        		jf+='</div></a></li>';
	      				}
	      				$(".user-integral ul").html(jf);
					}else{
						mui.toast(data.msg);
					}
				},
				error:function(){
					 
				}
			}) 
      	}
    </script>
</body>
</html>